﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace HRM.BO
{
    public class Role
    {
        Int32 _ID;
        public Int32 ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        
        String _RoleName;
        public String RoleName
        {
            get { return _RoleName; }
            set { _RoleName = value; }
        }
        String _Description;
        public String Description
        {
            get { return _Description; }
            set { _Description = value; }
        }
        
        DateTime _DateTimeCreated;
        public DateTime DateTimeCreated
        {
            get { return _DateTimeCreated; }
            set { _DateTimeCreated = value; }
        }

        DateTime _DateTimeLastUpdated;
        public DateTime DateTimeLastUpdated
        {
            get { return _DateTimeLastUpdated; }
            set { _DateTimeLastUpdated = value; }
        }

        Int32 _LastUpdatedBy;
        public Int32 LastUpdatedBy
        {
            get { return _LastUpdatedBy; }
            set { _LastUpdatedBy = value; }
        }
        
        public Role()
        { }

        public Role(DataRow dr)
        {
            if (dr["ID"] != DBNull.Value)
            {
                this._ID = Int32.Parse(dr["ID"].ToString());
            }
         
            if (dr["RoleName"] != DBNull.Value)
            {
                this._RoleName = dr["RoleName"].ToString();
            }
            if (dr["Description"] != DBNull.Value)
            {
                this._Description = dr["Description"].ToString();
            }
            if (dr["DateTimeCreated"] != DBNull.Value)
            {
                this._DateTimeCreated = Convert.ToDateTime(dr["DateTimeCreated"].ToString());
            }
            if (dr["DateTimeLastUpdated"] != DBNull.Value)
            {
                this._DateTimeLastUpdated = Convert.ToDateTime(dr["DateTimeLastUpdated"].ToString());
            }

            if (dr["LastUpdatedBy"] != DBNull.Value)
            {
                this._LastUpdatedBy = Convert.ToInt32(dr["LastUpdatedBy"].ToString());
            }
        }
    }
}
